﻿Ext.define('yzmh.view.comic.Edit', {
    extend: 'Ext.window.Window',
    alias: 'widget.comicedit',

    requires: ['Ext.form.Panel'],

    title: '编辑漫画',
    layout: 'fit',
    autoShow: true,
    width: 820,
    maximizable: true,

    initComponent: function () {

        this.items = [
            {
                xtype: 'form',
                border: true,
                frame: true,
                //width: 450,
                //bodyPadding: 5,
                bodyPadding: '5 5 5',
                fieldDefaults: {
                    labelAlign: 'right',
                    labelWidth: 60,
                    anchor: '100%'
                },
                items: [{
                    xtype: 'container',
                    anchor: '100%',
                    layout: 'hbox',
                    items: [{
                        xtype: 'container',
                        flex: 1,
                        layout: 'anchor',
                        items: [{
                            xtype: 'hidden',
                            name: 'id'
                        }, {
                            xtype: 'textfield',
                            name: 'mhmc',
                            fieldLabel: '漫画名称'
                        }, /*{
                            xtype: 'textfield',
                            name: 'zzmc',
                            fieldLabel: '作者名称'
                        },*/ Ext.create('Ext.ux.form.field.BoxSelect', {
                            fieldLabel: "漫画作者",
                            store: "Authors",
                            pageSize: 25,
                            typeAhead: true,
                            queryMode: "remote",
                            minChars: 1,
                            delimiter: ",",
                            forceSelection: false,
                            filterPickList: false,
                            //triggerOnClick: false,
                            labelTpl: "{zzmc}",
                            listConfig: {
                                tpl: [
                                   "<ul><tpl for=\".\">",
                                   "<li role=\"option\" class=\"x-boundlist-item\">{zzmc}[{diqu}] {zzbm}</li>",
                                   "</tpl></ul>"
                                ]
                            },
                            name: "zzmc",
                            displayField: "zzmc",
                            valueField: "zzmc",
                            emptyText: "请输入作者名称",
                            createNewOnEnter: true,
                            createNewOnBlur: true
                        }), {
                            xtype: 'combo',
                            name: 'classid',
                            store: 'Classes',
                            displayField: "classname",
                            valueField: "id",
                            fieldLabel: '分类',
                            queryMode: "local",
                            forceSelection: true,
                            editable: false
                        }, {
                            xtype: 'textfield',
                            name: 'zm',
                            fieldLabel: '字母'
                        }, {
                            xtype: 'checkbox',
                            name: 'zt',
                            fieldLabel: '完结状态'
                        }]
                    }, {
                        xtype: 'container',
                        flex: 1,
                        layout: 'anchor',
                        items: [{
                            xtype: 'textfield',
                            name: 'mhbm',
                            fieldLabel: '漫画别名'
                        }, {
                            xtype: 'textfield',
                            name: 'mhfm',
                            fieldLabel: '封面图片'
                        }, {
                            xtype: 'combo',
                            name: 'dqid',
                            store: 'Diqus',
                            displayField: "diqu",
                            valueField: "id",
                            fieldLabel: '地区',
                            queryMode: "local",
                            forceSelection: true,
                            editable: false
                        }, {
                            xtype: 'textfield',
                            name: 'comicdir',
                            fieldLabel: '漫画目录'
                        }, {
                            xtype: 'checkbox',
                            name: 'tj',
                            fieldLabel: '是否推荐'
                        }]
                    }]
                }, {
                    xtype: 'textarea',
                    name: 'mhjj',
                    fieldLabel: '漫画简介',
                    maxLength: 300
                }, {
                    xtype: 'ckeditor',
                    name: 'mhjs',
                    fieldLabel: '漫画介绍',
                    height: 300,
                    CKConfig: {
                        baseFloatZIndex: 20000,
                        resize_enabled: false
                    }
                }]
            }
        ];

        this.buttons = [
            {
                text: '保存',
                action: 'save'
            },
            {
                text: '取消',
                scope: this,
                handler: this.close
            }
        ];

        this.callParent(arguments);
    }
});
